package com.java.io;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;

public class BufferStreamTest {

	public static void main(String[] args) {
		FileInputStream fis = null;
		FileOutputStream fos = null;
		BufferedInputStream bis = null;
		BufferedOutputStream bos = null;
		try {
			fis = new FileInputStream(args[0]);
			bis=new BufferedInputStream(fis);
			fos=new FileOutputStream(args[1]);
			bos=new BufferedOutputStream(fos);
			int a;
			Date d1=new Date();
			while((a=bis.read())!=-1){
				bos.write(a);
			}
			Date d2=new Date();
			
			System.out.println("消耗时间："+(d2.getTime()-d1.getTime()));
		
//			Date d3=new Date();
//			while((a=fis.read())!=-1){
//				fos.write(a);
//			}
//			Date d4=new Date();
//			System.out.println("消耗时间："+(d4.getTime()-d3.getTime()));
//			bis.read()
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
